package com.glepoch.springbootsecuritymybatis.service.menu.impl;

import com.github.pagehelper.PageHelper;
import com.glepoch.springbootsecuritymybatis.bean.Menu;
import com.glepoch.springbootsecuritymybatis.bean.PageVO;
import com.glepoch.springbootsecuritymybatis.mappper.menu.MenuMapper;
import com.glepoch.springbootsecuritymybatis.service.menu.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ygl
 * @description 菜单
 * @date 2021年08月24日 20:19
 */
@Service
public class MenuServiceImpl implements MenuService {
    @Autowired
    MenuMapper menuMapper;

    @Override
    public List<Menu> findMenuPage(PageVO<Menu> pageVO) {
        PageHelper.startPage(pageVO.getStart(), pageVO.getLimit());
        List<Menu> menus = menuMapper.selectMenuPage(pageVO.getData());
        return menus;
    }

    @Override
    public List<Menu> findMenuByUserId(Long userId) {
        List<Menu> menus = menuMapper.selectMenuByUserId(userId);
        return menus;
    }

}
